]> dgit.raspbian.org Git - gnome-shell.git/commit
global: force fsync() to worker thread when saving state
authorChristian Hergert <chergert@redhat.com>
Wed, 26 Feb 2020 22:46:20 +0000 (14:46 -0800)
committerChristian Hergert <chergert@redhat.com>
Wed, 26 Feb 2020 23:33:30 +0000 (15:33 -0800)
commit19e084036a1dc3c5da010c3e7a42ce67df317797
tree0fd92c80379ba45880e2bedca4589d5c2bdb0472
parenta7d974e670673b331313098b09ebddd627aab8e3
global: force fsync() to worker thread when saving state

The g_file_replace_contents_async() API can potentially call fsync() from
the thread calling into it upon completion. This can have disasterous
effects when run from the compositor main thread such as complete stalls.

This is a followup to 86a00b6872375a266449beee1ea6d5e94f1ebbcb which
assumed (like the rest of us) that the fsync() would be performed on the
thread that was doing the I/O operations.

You can verify this with an strace -e fsync and cause terminal to display
a command completed notification (eg: from a backdrop window).

This also fixes a lifecycle bug for the variant, as
g_file_replace_contents_async() does not copy the data during the operation
as that is the responsibility of the caller. Instead, we just use a GBytes
variant and reference the variant there.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1050
src/shell-global.c